<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Stream Contexts</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="stream.filters.html">« Stream Filters</a></li>
      <li style="float: right;"><a href="stream.errors.html">Stream Errors »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="book.stream.html">Stream</a></li>
    <li>Stream Contexts</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="stream.contexts" class="chapter">
 <h1>Stream Contexts</h1>

 <p class="simpara">
  A <code class="literal">context</code> is a set of <code class="literal">parameters</code> and 
  wrapper specific <code class="literal">options</code> which modify or enhance the
  behavior of a stream.  <code class="literal">Contexts</code> are created using
  <span class="function"><a href="function.stream-context-create.html" class="function">stream_context_create()</a></span> and can be passed to most
  filesystem related stream creation functions (i.e. <span class="function"><a href="function.fopen.html" class="function">fopen()</a></span>,
  <span class="function"><a href="function.file.html" class="function">file()</a></span>, <span class="function"><a href="function.file-get-contents.html" class="function">file_get_contents()</a></span>, etc...).
 </p>
 <p class="simpara">
  <code class="literal">Options</code> can be specified when calling 
  <span class="function"><a href="function.stream-context-create.html" class="function">stream_context_create()</a></span>, or later using
  <span class="function"><a href="function.stream-context-set-option.html" class="function">stream_context_set_option()</a></span>.
  A list of wrapper specific <code class="literal">options</code> can be found in the
  <a href="context.html" class="xref">上下文（Context）选项和参数</a> chapter.
 </p>
 <p class="simpara">
  <code class="literal">Parameters</code> can be specified for
  <code class="literal">contexts</code> using the
  <span class="function"><a href="function.stream-context-set-params.html" class="function">stream_context_set_params()</a></span> function.
 </p>
</div>
</div></div></body></html>